<template>
<div>
  <el-card shadow="hover">
    <el-form :inline="true" :model="${(businessCode?uncap_first)!''}SearchForm" ref="${(businessCode?uncap_first)!''}SearchForm" label-width="102px">
      <el-form-item label="${businessName!}名称" prop="${(businessCode?uncap_first)!''}Name">
        <el-autocomplete
          popper-class="my-autocomplete"
          v-model="${(businessCode?uncap_first)!''}SearchForm.${(businessCode?uncap_first)!''}Name"
          :fetch-suggestions="${(businessCode?uncap_first)!''}SearchForm${businessCode!''}QuerySearchAsync"
          placeholder="请输入${businessName!}名称"
          @select="item => ${(businessCode?uncap_first)!''}SearchForm.${(businessCode?uncap_first)!''}Code = item.code"
          clearable>
          <template slot-scope="{ item }">
            <div class="name">${businessName!}编号：{{ item.code }}</div>
            <span class="code">${businessName!}名称：{{ item.value }}</span>
          </template>
        </el-autocomplete>
      </el-form-item>
      <el-form-item label="${businessName!}编号" prop="${(businessCode?uncap_first)!''}Code">
        <el-input v-model="${(businessCode?uncap_first)!''}SearchForm.${(businessCode?uncap_first)!''}Code" placeholder="请输入${businessName!}编号" clearable></el-input>
      </el-form-item>
      <el-form-item label="创建日期" prop="createdDate" v-if="${(businessCode?uncap_first)!''}SearchFormShowFull">
        <el-date-picker
          v-model="${(businessCode?uncap_first)!''}SearchForm.createdDate"
          type="daterange"
          align="right"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :picker-options="${(businessCode?uncap_first)!''}SearchFormCreatedDateOptions">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button v-loading="${(businessCode?uncap_first)!''}SearchPageLoading" type="primary" icon="el-icon-search"
                   @click="${(businessCode?uncap_first)!''}SearchFormSubmit(1)">
          搜索
        </el-button>
        <el-button icon="el-icon-refresh" @click="${(businessCode?uncap_first)!''}SearchFormResetFields">重置</el-button>
        <el-switch v-model="${(businessCode?uncap_first)!''}SearchFormShowFull" active-text="高级搜索"></el-switch>
        <el-switch v-model="${(businessCode?uncap_first)!''}SearchForm.fuzzySearch" active-text="模糊搜索"></el-switch>
      </el-form-item>
    </el-form>
  </el-card>
  <el-card shadow="hover">
    <el-button type="primary" icon="el-icon-news" size="small" @click="${(businessCode?uncap_first)!''}AddFormDialogVisible = true"
               v-if="permission_add">新增
    </el-button>
    <el-badge :value="this.${(businessCode?uncap_first)!''}SearchPageSelection.length"
              :hidden="this.${(businessCode?uncap_first)!''}SearchPageSelection.length < 1"
              class="item" v-if="permission_delete">
      <el-button v-loading="toolbarDeletes${businessCode!''}Loading" type="danger" icon="el-icon-delete" size="small"
                 @click="toolbarDeletes${businessCode!''}Click">批量删除
      </el-button>
    </el-badge>
    <a target="_blank" :href="'${api_root_url!}/v1/${moduleMapperCode}/${(businessCode?uncap_first)!''}/m0005.json?' + ${(businessCode?uncap_first)!''}SearchFormQueryString"
       v-if="permission_export">
      <el-button type="warning" icon="el-icon-document" size="small">导出excel</el-button>
    </a>
    <a target="_blank" href="/download_import_template/${(businessCode?uncap_first)!''}.xls?action=download">
      <el-button type="info" icon="el-icon-download" size="small">下载excel模板</el-button>
    </a>
    <el-upload ref="toolbarImport${businessCode!''}"
               style="display: inline"
               :with-credentials="true"
               accept=".xls"
               :before-upload="toolbarImport${businessCode!''}BeforeUpload"
               :on-success="toolbarImport${businessCode!''}Success"
               :on-error="toolbarImport${businessCode!''}Error"
               action="${api_root_url!}/v1/${moduleMapperCode}/${(businessCode?uncap_first)!''}/m0004.json"
               v-if="permission_import">
      <el-button v-loading="toolbarImport${businessCode!''}Loading" type="success" icon="el-icon-upload2" size="small">
        导入excel
      </el-button>
    </el-upload>
  </el-card>
  <el-table ref="${(businessCode?uncap_first)!''}SearchPageTable"
            v-loading="${(businessCode?uncap_first)!''}SearchPageLoading"
            element-loading-text="拼命加载中"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(0, 0, 0, 0.8)"
            :data="${(businessCode?uncap_first)!''}SearchPage.datas"
            border
            @selection-change="${(businessCode?uncap_first)!''}SearchPageSelectionChange"
            style="width: 100%"
            :height="${(businessCode?uncap_first)!''}SearchPageTableHeight">
    <el-table-column
      type="selection"
      width="55">
    </el-table-column>
    <el-table-column
      fixed
      prop="${(businessCode?uncap_first)!''}Code"
      label="编号"
      min-width="112">
    </el-table-column>
    <el-table-column
      prop="name"
      label="名称"
      min-width="112">
    </el-table-column>
    <el-table-column
      prop="createdByName"
      label="创建人姓名"
      min-width="112">
    </el-table-column>
    <el-table-column
      prop="createdDate"
      label="创建时间"
      min-width="224">
    </el-table-column>
    <el-table-column
      fixed="right"
      label="操作"
      width="136">
      <template slot-scope="scope">
        <el-button type="text" size="small" @click="${(businessCode?uncap_first)!''}SearchPageViewClick(scope.row)">查看</el-button>
        <el-button type="text" size="small" @click="${(businessCode?uncap_first)!''}SearchPageModifyClick(scope.row)"
                   v-if="permission_modify">
          编辑
        </el-button>
        <el-button v-loading="${(businessCode?uncap_first)!''}SearchPageDeleteLoading" type="text" size="small"
                   @click="${(businessCode?uncap_first)!''}SearchPageDeleteClick(scope.row)" v-if="permission_delete">
          删除
        </el-button>
      </template>
    </el-table-column>
  </el-table>
  <el-pagination v-if="${(businessCode?uncap_first)!''}SearchPage.totalElements > 0"
                 @size-change="${(businessCode?uncap_first)!''}SearchFormPaginationSizeChange"
                 @current-change="${(businessCode?uncap_first)!''}SearchFormSubmit"
                 :current-page="${(businessCode?uncap_first)!''}SearchForm.page"
                 :page-sizes="[10, 20, 40, 80, 160, 320, 640]"
                 :page-size="${(businessCode?uncap_first)!''}SearchForm.pageSize"
                 layout="total, sizes, prev, pager, next, jumper"
                 :total="${(businessCode?uncap_first)!''}SearchPage.totalElements">
  </el-pagination>
  <el-dialog title="${businessName!}新增" :visible.sync="${(businessCode?uncap_first)!''}AddFormDialogVisible"
             @closed="${(businessCode?uncap_first)!''}AddFormDialogClosed">
    <el-form :model="${(businessCode?uncap_first)!''}AddForm" :rules="${(businessCode?uncap_first)!''}AddFormRules" ref="${(businessCode?uncap_first)!''}AddForm"
             label-width="114px" style="max-height: 360px; overflow-y: auto;">
      <el-form-item label="${businessName!}编号" prop="${(businessCode?uncap_first)!''}Code">
        <el-input v-model="${(businessCode?uncap_first)!''}AddForm.${(businessCode?uncap_first)!''}Code"
                  clearable></el-input>
      </el-form-item>
      <el-form-item label="${businessName!}名称" prop="name">
        <el-input v-model="${(businessCode?uncap_first)!''}AddForm.name"
                  clearable></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="${(businessCode?uncap_first)!''}AddFormDialogVisible = false">取 消</el-button>
      <el-button v-loading="${(businessCode?uncap_first)!''}AddFormSubmitLoading" type="primary" @click="${(businessCode?uncap_first)!''}AddFormSubmit">确 定</el-button>
    </div>
  </el-dialog>
  <el-dialog title="${businessName!}编辑" :visible.sync="${(businessCode?uncap_first)!''}ModifyFormDialogVisible"
             @closed="${(businessCode?uncap_first)!''}ModifyFormDialogClosed">
    <el-form :model="${(businessCode?uncap_first)!''}ModifyForm" :rules="${(businessCode?uncap_first)!''}ModifyFormRules" ref="${(businessCode?uncap_first)!''}ModifyForm"
             label-width="114px" style="max-height: 360px; overflow-y: auto;">
      <el-form-item label="${businessName!}编号" prop="${(businessCode?uncap_first)!''}Code">
        <el-input v-model="${(businessCode?uncap_first)!''}ModifyForm.${(businessCode?uncap_first)!''}Code"
                  clearable></el-input>
      </el-form-item>
      <el-form-item label="${businessName!}名称" prop="name">
        <el-input v-model="${(businessCode?uncap_first)!''}ModifyForm.name"
                  clearable></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="${(businessCode?uncap_first)!''}ModifyFormDialogVisible = false">取 消</el-button>
      <el-button v-loading="${(businessCode?uncap_first)!''}ModifyFormSubmitLoading" type="primary" @click="${(businessCode?uncap_first)!''}ModifyFormSubmit">确 定
      </el-button>
    </div>
  </el-dialog>
  <el-dialog title="${businessName!}查看" :visible.sync="${(businessCode?uncap_first)!''}ViewFormDialogVisible"
             @closed="${(businessCode?uncap_first)!''}ViewFormDialogClosed">
    <el-form :model="${(businessCode?uncap_first)!''}ViewForm" ref="${(businessCode?uncap_first)!''}ViewForm"
             label-width="102px" style="max-height: 360px; overflow-y: auto;">
      <el-form-item label="${businessName!}编号" prop="${(businessCode?uncap_first)!''}Code">
        <el-input :value="${(businessCode?uncap_first)!''}ViewForm.${(businessCode?uncap_first)!''}Code" readOnly></el-input>
      </el-form-item>
      <el-form-item label="${businessName!}名称" prop="name">
        <el-input :value="${(businessCode?uncap_first)!''}ViewForm.name" readOnly></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="${(businessCode?uncap_first)!''}ViewFormDialogVisible = false">关闭</el-button>
    </div>
  </el-dialog>
</div>
</template>

<script src="./index.vue.js"></script>
